package shapes;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;

/**
 * Cette classe contient les informations pour les objets
 * de type Rectangle et Carré
 * @author Maria Garcia Carrasco et Andrew Bolduc
 */

public class Rectangle extends AbstractShape {
	
	/**
	 * @param shapeID
	 * @param shape
	 * @param color
	 * @param xOrigin
	 * @param yOrigin
	 * @param xEnd
	 * @param yEND
	 */
	public Rectangle(int shapeID, String shape, Color color, int xOrigin, int yOrigin, int secondX, int secondY) {
		super(shapeID, shape, color, xOrigin, yOrigin, secondX, secondY);
	}

	/**
	 * @return
	 */
	public int getWidth() {		
		return super.getSecondX() - super.getxCoord();
	}

	/**
	 * @return
	 */
	public int getHeight() {
		return super.getSecondY() - super.getyCoord();
	}


	/* (non-Javadoc)
	 * @see shapes.AbstractShape#draw(java.awt.Graphics)
	 */
	@Override
	public void draw(Graphics graphics) {
		graphics.setColor(this.getColor());
		graphics.fillRect(super.getxCoord(), super.getyCoord(), getWidth(), getHeight());
		graphics.setColor(Color.BLACK);
		graphics.drawRect(super.getxCoord(), super.getyCoord(), getWidth(), getHeight());
	}

	/* (non-Javadoc)
	 * @see interfaces.IShape#area()
	 */
	@Override
	public float area() {
		float area = (float)(getWidth() * getHeight());		
		return area;
	}

	@Override
	public int getDistance() {
		return (int)Math.sqrt((Math.pow((this.getxCoord() - super.getSecondX()), 2)) + (Math.pow((this.getyCoord() - super.getSecondY()), 2)));
	}

	/*public void setWidth(int width) {
		super.setSecondX(width);
	}

	public void setHeight(int height) {
		super.setSecondY(height);
	}*/

}